package com.atguigu.classroom.vod.controller;

import com.atguigu.classroom.result.Result;
import com.atguigu.classroom.vod.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "文件上传接口")
@RestController
@RequestMapping("/admin/vod/file/")
public class FileUploadController {
    @Autowired
    private FileService fileService;
    @ApiOperation("文件上传方法")
    @PostMapping("upload")
    public Result upload(MultipartFile file){
        System.out.println("我进来了");
        String url=fileService.uploadFile(file);
        return Result.ok(url).message("文件上传成功");
    }
}
